class Solution {
    public int sum(NodeList head) {
        int sum = 0;
        while (head != null){
            sum += head.value;
            head = head.next;
        }
        return sum;
    }
}